package j01;

import java.util.Scanner;

public class j03 {

	public static void main(String[] args) {
	      Scanner scanner=new Scanner(System.in);
	      int a=scanner.nextInt();
	      double m=a%5;
	      System.out.println(m);
	}

}
